﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Cadastros/Site.Master" AutoEventWireup="true" CodeBehind="Relatorios.aspx.cs" Inherits="CongregacaoOs.WebForm.Cadastros.Relatorios" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
    
    <link href="../Content/themes/base/jquery.ui.datepicker.css" rel="stylesheet" />
    <script src="Radio/js/jquery.screwdefaultbuttonsV2.js"></script>
    <script type="text/javascript">

        $(document).ready(function () {
            var activeIndex = parseInt($('#<%=hfIndexAccordion.ClientID %>').val());

            $("#accordion").accordion({
                collapsible: true,
                autoHeight: false,
                navigation: true,
                active: activeIndex,
                change: function (event, ui) {
                    var index = $(this).children('h3').index(ui.newHeader);
                    $('#<%=hfIndexAccordion.ClientID %>').val(index);
                }
            });
        });

        $(function () {
            $("#txtDataInicioBuscar").datepicker({

                changeMonth: false,
                numberOfMonths: 1,
                buttonImage: "dock/jqueryui/images/calendar.gif",
                dateFormat: "dd/mm/yy",
                showAnim: "slide",
                onClose: function (selectedDate) {
                    $("#txtDatafimBuscar").datepicker("option", "minDate", selectedDate);
                }
            });

            $("#txtDatafimBuscar").datepicker({
                defaultDate: "+1w",
                changeMonth: false,
                numberOfMonths: 1,
                buttonImage: "dock/jqueryui/images/calendar.gif",
                dateFormat: "dd/mm/yy",
                showAnim: "slide",
                onClose: function (selectedDate) {
                    $("#txtDataInicioBuscar").datepicker("option", "maxDate", selectedDate);
                }
            });

            $("#txtDataPrazo").datepicker({
                defaultDate: "+1w",
                changeMonth: false,
                numberOfMonths: 1,
                dateFormat: "dd/mm/yy",
                showAnim: "slide",
                onClose: function (selectedDate) {
                    $("#txtDataInicioBuscar").datepicker("option", "maxDate", selectedDate);
                }
            });


        });



    </script>

    <link href="../Content/NewTheme/gridView.css" rel="stylesheet" />
    <style type="text/css">
        .auto-style12 {
            width: 98px;
        }

        .auto-style13 {
            width: 275px;
        }

        .auto-style14 {
            width: 71px;
        }

        .auto-style15 {
            width: 280px;
        }

        .auto-style16 {
            width: 72px;
        }

        .auto-style17 {
            width: 102px;
        }

        .auto-style18 {
            width: 410px;
        }

        .auto-style19 {
            width: 97px;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="FeaturedContent" runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="MainContent" runat="server">
  <asp:HiddenField ID="hfIndexAccordion" runat="server" />

    <h2>Ordem de Serviço</h2>
    <hr />

    <div id="accordion">
        <h3><a href="#">Consultar</a></h3>
        <div>
            <table style="width: 763px">
                <tr>
                    <td class="auto-style17">Código</td>
                    <td class="auto-style13">
                        <asp:TextBox runat="server" ID="txtCodigoBuscar" Width="200px"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td class="auto-style12"></td>
                    <td class="auto-style15"></td>
                </tr>
                <tr>

                    <td class="auto-style17">Data Início</td>
                    <td class="auto-style13">
                        <asp:TextBox runat="server" ID="txtDataInicioBuscar" ClientIDMode='Static' Width="200px"></asp:TextBox></td>

                    <td class="auto-style14">Data Fim</td>
                    <td>
                        <asp:TextBox runat="server" ID="txtDatafimBuscar" ClientIDMode='Static' Width="200px"></asp:TextBox><br />
                    </td>
                </tr>
                <tr>
                    <td class="auto-style12"></td>
                    <td class="auto-style15"></td>
                </tr>
                <tr>
                    <td class="auto-style12">Regional:</td>
                    <td class="auto-style15">

                        <asp:DropDownList ID="dropRegionalFiltro" DataTextField="regional" DataValueField="idRegional" runat="server" AutoPostBack="True" Height="21px" Width="271px" Style="margin-left: 0px" OnDataBound="dropRegionalFiltro_DataBound" OnSelectedIndexChanged="dropRegionalFiltro_SelectedIndexChanged">
                        </asp:DropDownList>
                    </td>
                    <td class="auto-style16">Distrital:</td>
                    <td>
                        <asp:DropDownList ID="dropDistritalFiltro" DataTextField="distrital" DataValueField="idDistrital" runat="server" AutoPostBack="True" Height="22px" Width="271px" OnDataBound="dropDistritalFiltro_DataBound" OnSelectedIndexChanged="dropDistritalFiltro_SelectedIndexChanged"></asp:DropDownList>
                    </td>
                </tr>
                <tr>
                    <td class="auto-style12"></td>
                    <td></td>
                </tr>
                <tr>
                    <td class="auto-style12"></td>
                    <td class="auto-style15"></td>
                </tr>
                <tr>
                    <td class="auto-style12">Administração:</td>
                    <td class="auto-style15">
                        <asp:DropDownList ID="dropAdmFiltro" DataTextField="adm" DataValueField="idAdm" runat="server" Height="22px" Width="271px" AutoPostBack="True" OnDataBound="dropAdmFiltro_DataBound" OnSelectedIndexChanged="dropAdmFiltro_SelectedIndexChanged"></asp:DropDownList>
                    </td>
                    <td class="auto-style16">Setores:</td>
                    <td>
                        <asp:DropDownList ID="dropSetorFiltro" DataTextField="nome" DataValueField="idSetor" runat="server" Height="22px" Width="271px" AutoPostBack="True" OnDataBound="dropSetorFiltro_DataBound" OnSelectedIndexChanged="dropSetorFiltro_SelectedIndexChanged"></asp:DropDownList>
                    </td>
                </tr>
                <tr>
                    <td class="auto-style12"></td>
                    <td class="auto-style15"></td>
                </tr>
            </table>
            <table>
                <tr>
                    <td class="auto-style19">Status</td>
                    <td class="auto-style18">
                        <asp:RadioButtonList ID="radioStatusFiltro" AutoPostBack="true" runat="server" RepeatDirection="Vertical" RepeatLayout="Flow" Width="353px" ToolTip="Status da O.S" CellPadding="5" Height="20px">
                            <asp:ListItem Value="0">Aguardando</asp:ListItem>
                            <asp:ListItem Value="1">Atendimento</asp:ListItem>
                            <asp:ListItem Value="2">Concluída</asp:ListItem>
                            <asp:ListItem Value="3" Selected="True">Todas</asp:ListItem>
                        </asp:RadioButtonList></td>
                </tr>
            </table>
            <br />

            <asp:GridView ID="gvOs" runat="server"
                AutoGenerateColumns="False"
                GridLines="None"
                AllowPaging="True"
                CssClass="mGrid"
                PagerStyle-CssClass="pgr"
                AlternatingRowStyle-CssClass="alt" OnRowCommand="gvOs_RowCommand" OnRowDataBound="gvOs_RowDataBound" PageSize="7" OnPageIndexChanging="gvOs_PageIndexChanging">
                <AlternatingRowStyle CssClass="alt" />
                <Columns>
                    <asp:TemplateField>
                        <ItemTemplate>
                            <asp:ImageButton ImageUrl="../Images/editar.png" CommandName="EDITAR" ToolTip="Editar O.S" runat="server" Width="20px" ID="imgEditar" />
                            &nbsp;&nbsp;&nbsp;
                            <asp:ImageButton ImageUrl="../Images/forum.png" runat="server" CommandName="FORUM" ToolTip="Forum" Width="20px" ID="imgForum" />

                            <%--Dados Gerais da O.S--%>
                            <asp:HiddenField ID="hdIdOs" runat="server" Value="<%# Bind('idOs') %>" />
                            <asp:HiddenField ID="hdCodigo" runat="server" Value="<%# Bind('codigo') %>" />
                            <asp:HiddenField ID="hdDataCriacao" runat="server" Value="<%# Bind('dataCriacao') %>" />
                            <asp:HiddenField ID="hdTitulo" runat="server" Value="<%# Bind('titulo') %>" />
                            <asp:HiddenField ID="hdTexto" runat="server" Value="<%# Bind('texto') %>" />
                            <asp:HiddenField ID="hdStatus" runat="server" Value="<%# Bind('status') %>" />
                            <asp:HiddenField ID="hdDataPrazo" runat="server" Value="<%# Bind('dataprazo') %>" />
                            <asp:HiddenField ID="hdTipoOs" runat="server" Value="<%# Bind('tipoOs') %>" />
                            <%--Dados Quem Gerou a O.S--%>
                            <asp:HiddenField ID="hdUsuarioIn" runat="server" Value="<%# Bind('UsuarioIn') %>" />
                            <asp:HiddenField ID="hdRegionalIn" runat="server" Value="<%# Bind('RegionalIn') %>" />
                            <asp:HiddenField ID="hdDistritalIn" runat="server" Value="<%# Bind('DistritalIn') %>" />
                            <asp:HiddenField ID="hdAdmIn" runat="server" Value="<%# Bind('AdmIn') %>" />
                            <asp:HiddenField ID="hdCidadeIn" runat="server" Value="<%# Bind('CidadeIn') %>" />
                            <%--Quem Executará a O.S--%>
                            <asp:HiddenField ID="hdRegionalOut" runat="server" Value="<%# Bind('RegionalOut') %>" />
                            <asp:HiddenField ID="hdDistritalOut" runat="server" Value="<%# Bind('DistritalOut') %>" />
                            <asp:HiddenField ID="hdAdmOut" runat="server" Value="<%# Bind('AdmOut') %>" />
                            <asp:HiddenField ID="hdCidadeOut" runat="server" Value="<%# Bind('CidadeOut') %>" />
                            <asp:HiddenField ID="hdSetorOut" runat="server" Value="<%# Bind('SetorOut') %>" />
                            <asp:HiddenField ID="hdAnexo" runat="server" Value="<%# Bind('anexo') %>" />
                            <asp:HiddenField ID="hdServoQExecutara" runat="server" Value="<%# Bind('idServoQExecutara') %>" />
                            <asp:HiddenField ID="hdEnviarEmailSetor" runat="server" Value="<%# Bind('EnviarEmailSetor') %>" />


                        </ItemTemplate>
                        <ItemStyle Width="15%" HorizontalAlign="Center" VerticalAlign="Middle" />
                    </asp:TemplateField>
                    <asp:BoundField DataField="Codigo" HeaderText="Código" HtmlEncode="False">
                        <HeaderStyle HorizontalAlign="center" />
                        <ItemStyle HorizontalAlign="Center" />
                    </asp:BoundField>

                    <asp:BoundField DataField="dataCriacao" DataFormatString="{0:dd/MM/yyyy}" HeaderText="Gerada" HtmlEncode="False">
                        <ItemStyle Width="10%" />
                        <HeaderStyle HorizontalAlign="Left" />
                    </asp:BoundField>

                    <asp:BoundField DataField="dataPrazo" DataFormatString="{0:dd/MM/yyyy}" HeaderText="Prazo" HtmlEncode="false">
                        <ItemStyle Width="10%" />
                        <HeaderStyle HorizontalAlign="Left" />
                    </asp:BoundField>

                    <asp:BoundField DataField="TipoOs" HeaderText="TipoOs" HtmlEncode="False">
                        <ItemStyle Width="10%" />
                        <HeaderStyle HorizontalAlign="Left" />
                    </asp:BoundField>
                    <asp:BoundField DataField="AdmIn" HeaderText="Aberto Por" HtmlEncode="false">
                        <ItemStyle Width="15%" />
                        <HeaderStyle HorizontalAlign="Left" />
                    </asp:BoundField>
                    <asp:BoundField DataField="AdmOut" HeaderText="Dirigida há" HtmlEncode="false">
                        <ItemStyle Width="15%" />
                        <HeaderStyle HorizontalAlign="Left" />
                    </asp:BoundField>
                    <asp:BoundField DataField="status" HeaderText="Status" HtmlEncode="false">
                        <ItemStyle Width="10%" HorizontalAlign="Center" />
                    </asp:BoundField>

                </Columns>
                <EmptyDataTemplate>
                    Nenhum registro encontrado...
                </EmptyDataTemplate>
                <PagerStyle CssClass="pgr" />
            </asp:GridView>
            <div style="float: right;">
                <asp:Button ID="btnBuscar" runat="server" Text="Buscar"  Width="159px" OnClick="btnBuscar_Click" />
                <asp:Button ID="btnGerarOs" runat="server" Text="Gerar Nova O.S" OnClick="btnGerarOs_Click" Width="159px" />
            </div>
        </div>
</asp:Content>
